<h3>Lista de Cadastros</h3>
<?php if(!empty($this->tables)) { ?>
	<form action="" method="post">
		<table style="float: right;">
			<tr>
				<td><input type="text" name="search" value="" /></td>
				<td>
					<input type="submit" value="Buscar" />
					<input type="submit" name="clear" value="Limpar Filtro" />
				</td>
			</tr>
		</table>
	</form>
	<table border="1" width="100%">
		<thead>
			<tr>
				<th>Table Name</th>
				<?php if(isset($table['columns'])) { ?>
					<th>Columns</th>
				<?php } ?>
			</tr>
		</thead>
		<tbody>
			<?php foreach($this->tables as $table) { ?>
				<tr>
					<td><a href="<?php echo $this->basePath; ?>/cms/list/t/<?php echo $table['tablename']; ?>"><?php echo $table['tablename']; ?></a></td>
					<?php if(isset($table['columns'])) { ?>
						<td>
							<table width="100%">
								<thead>
									<tr>
										<th>Name</th>
										<th>Can be null?</th>
										<th>Data Type</th>
										<th>Constraint</th>
									</tr>
								</thead>
								<tbody>
									<?php foreach($table['columns'] as $column) { ?>
										<tr>
											<td style="border: 1px solid #2A2A2A;"><?php echo $column['column_name']; ?></td>
											<td style="border: 1px solid #2A2A2A;"><?php echo ($column['notnull']) ? 'no' : 'yes'; ?></td>
											<td style="border: 1px solid #2A2A2A;"><?php echo $column['type']; ?></td>
											<td style="border: 1px solid #2A2A2A;">
												<?php if($column['is_primary']) { ?>
													primary
												<?php } elseif(!empty($column['reference'])) { ?>
													foreign
												<?php } else { ?>

												<?php } ?>
											</td>
										</tr>
									<?php } ?>
								</tbody>
							</table>
						</td>
					<?php } ?>
				</tr>
			<?php } ?>
		</tbody>
	</table>
	<?php echo $this->paginationControl($this->tables, 'Sliding', '/cms/paginator.phtml'); ?>
<?php } else { ?>
	Não existe nenhum cadastro para ser editado!
<?php } ?>